package com.webproject.dao.impl.householdManager;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.webproject.core.Page;
import com.webproject.dao.householdManager.HouseholdManagerDao;
import com.webproject.entity.houseManager.Building;
import com.webproject.entity.houseManager.RoomInfo;
import com.webproject.entity.householdManager.Complain;
import com.webproject.entity.householdManager.HouseApproval;
import com.webproject.entity.householdManager.Household;

public class HouseholdManagerDaoImpl extends SqlMapClientDaoSupport implements HouseholdManagerDao {

	@Override
	public List<Household> queryHousehold(Page page) {
		// TODO Auto-generated method stub
		return getSqlMapClientTemplate().queryForList("householdManager.queryHousehold", page);
	}

	@Override
	public int queryHouseholdCount(Page page) {
		// TODO Auto-generated method stub
		return (Integer) getSqlMapClientTemplate().queryForObject("householdManager.queryHouseholdCount", page);
	}

	@Override
	public void saveHousehold(Household household) {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().insert("householdManager.saveHousehold", household);
	}

	@Override
	public void updateHousehold(Household household) {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().update("householdManager.updateHousehold", household);
	}

	@Override
	public Building queryBuildingByHousehold(String id) {
		// TODO Auto-generated method stub
		return (Building) getSqlMapClientTemplate().queryForObject("householdManager.queryBuildingByHousehold", id);
	}

	@Override
	public RoomInfo queryRoomByHousehold(String id) {
		// TODO Auto-generated method stub
		return (RoomInfo) getSqlMapClientTemplate().queryForObject("householdManager.queryRoomByHousehold", id);
	}

	@Override
	public List<HouseApproval> queryHouseApproval(Page page) {
		// TODO Auto-generated constructor stub
		return getSqlMapClientTemplate().queryForList("householdManager.queryHouseApproval",page);
	}

	@Override
	public int queryHouseApprovalCount(Page page) {
		// TODO Auto-generated constructor stub
		return (Integer) getSqlMapClientTemplate().queryForObject("householdManager.queryHouseApprovalCount", page);
	}

	@Override
	public void saveHouseApproval(HouseApproval approval) {
		// TODO Auto-generated constructor stub
		getSqlMapClientTemplate().insert("householdManager.saveHouseApproval", approval);
	}

	@Override
	public void updateHouseApproval(HouseApproval approval) {
		// TODO Auto-generated constructor stub
		getSqlMapClientTemplate().update("householdManager.updateHouseApproval", approval);
	}

	@Override
	public void deleteHouseApproval(HouseApproval approval) {
		// TODO Auto-generated constructor stub
		getSqlMapClientTemplate().delete("householdManager.deleteHouseApproval", approval);
	}

	@Override
	public List<Complain> queryComplain(Page page) {
		// TODO Auto-generated method stub
		return getSqlMapClientTemplate().queryForList("householdManager.queryComplain",page);
	}

	@Override
	public int queryComplainCount(Page page) {
		// TODO Auto-generated method stub
		return (Integer) getSqlMapClientTemplate().queryForObject("householdManager.queryComplainCount", page);
	}

	@Override
	public void saveComplain(Complain complain) {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().insert("householdManager.saveComplain", complain);
	}

	@Override
	public void updateComplain(Complain complain) {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().update("householdManager.updateComplain", complain);
	}

	@Override
	public void deleteComplain(Complain complain) {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().delete("householdManager.deleteComplain", complain);
	}


}
